package com.itita.ww2.web.server;

import java.io.IOException;
import java.util.Map;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.itita.ww2.common.WebProxy;
import com.itita.ww2.common.WebResponse;
import com.itita.ww2.web.core.AbstractHttpServlet;

/**
 * 重置状态
 * @author NorthLan
 *
 */
@SuppressWarnings("serial")
public class ResetWorldMapState extends AbstractHttpServlet {

	@Override
	protected String handleRequest(WebProxy webProxy, HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		int blockId = -1;
		int cityId = -1;
		int baseId = -1;
		// 
		Map<String, String[]> params = req.getParameterMap();
		if (params.containsKey("blockId")) {
			blockId = Integer.valueOf(req.getParameter("blockId"));
		}
		if (params.containsKey("cityId")) {
			cityId = Integer.valueOf(req.getParameter("cityId"));
		}
		if (params.containsKey("baseId")) {
			baseId = Integer.valueOf(req.getParameter("baseId"));
		}
		WebResponse ret = webProxy.resetWorldMapState(blockId, cityId, baseId);
		return ret.toJson();
	}
}
